<?php defined('SYSPATH') or die('No direct script access.');
	

	class Controller_Plotter extends Controller {
		
		public function action_finalsegment(){
			$id = $this->request->param("id");
			$segment = Helper_Service::factory("analysis",$id)->getFinalSegment();
			$segment->toChart("Registro Final","FinalSegment",false);
		}
		
		public function action_finalsegmenthumb(){
			
		}
		
		//debe de ser en blanco y negro (apto para el reporte)
		public function action_reportsegment(){
			ini_set("memory_limit","32M");
			
			$id = $this->request->param("id");
			$toFile = $this->request->param("id2");
			
			$settings = Model::factory("chartsettings");
			$settings->seriesName = "FinalSegment";
			$settings->dataLabelSkip = 20;
			$settings->YAxisLabel = "Amplitud [%]";
			$settings->XAxisLabel = "Tiempo [ms]";
			$settings->setSeriesColor(0,0,0);
			$settings->setAxisBoundaries(0,100);
			$settings->chartHeight =  200;
			$settings->chartWidth =  400;
			$settings->chartTitle = "Registro Promedio";
			$settings->blackWhite = true;
						
			$segment = Helper_Service::factory("analysis",$id)->getFinalSegment();
			
			if ($toFile){
				$segment->toChart("Registro Promedio","FinalSegment",false,$settings,"finalSegment.png");	
			}else{
				$segment->toChart("Registro Promedio","FinalSegment",false,$settings);
			}
			
			
		}
		
		public function action_selectedsegment(){
			
		}
		
		public function action_selectedsegmenthumb(){
			$id_analysis = $this->request->param("id");
			$id_segment = $this->request->param("id2");
			$segments_service = Helper_Service::factory("analysis",$id_analysis)->getSelectedSegments();
			$selected = $segments_service->getSelectedSegment($id_segment);
			$thumb = $segments_service->getSegmentData($selected->segment);
			$thumb->toChart("Segmento ".$selected->number,"Segment",true);
		}
		
		
		
		
		
	}
?>